<?php
echo $javascript->codeBlock("
	$(document).ready(function(){
		$('input#id_search').quicksearch('table#table_users_list tbody tr');
	});		
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>


<div class="main_body">
	<div id="left_column">
    <?php echo $this->element('main_menu')?>		
  	<?php echo $this->element('/orders/search_form')?>
    </div>	
	
	<div id="main_body_content">
	
	
		<div class="orders index">
			<h1><?php __("Orders");?></h1>
			<table cellpadding="0" cellspacing="0">
			<tr>
					<th><?php echo $this->Paginator->sort('customer_id');?></th>
					<th><?php echo $this->Paginator->sort('type_of_service_id');?><br/><?php echo $this->Paginator->sort('types_of_spaces_id');?></th>
					<th><?php echo $this->Paginator->sort('status_of_implementation');?><br/><?php echo $this->Paginator->sort('payment_status');?></th>
					<th><?php echo $this->Paginator->sort('name');?></th>
					<th class="actions">&nbsp;</th>
			</tr>
			<?php
			$i = 0;
			foreach ($orders as $order):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="altrow"';
				}
			?>
			<tr<?php echo $class;?>>
				<td>
					<?php echo $order['Customer']['name']?> <?php echo $order['Customer']['surname']?><br/>
					<?php echo $order['Customer']['address1']?> <?php echo $order['Customer']['address2']?><br/>
					<?php 
						$url = 'http://maps.google.com/maps?q='.$order['Customer']['address1'].','.$order['Customer']['address2'].','.$order['Customer']['address3'].','.$order['Customer']['address4'];
						echo $html->link(__("Find on map",true),$url, array('target'=>'_blank'))?>
				</td>
				<td>
					<?php echo $order['TypeOfService']['name']; ?> <br/>
					<?php echo $order['TypesOfSpaces']['name']; ?><br/>
					<?php echo $typeOfCycles[$order['OrdersCycle']['type_of_cycle_id']]?>
				</td>
				<td><?php echo $statusOfImplementation[$order['Order']['status_of_implementation']]; ?>&nbsp;<br/><?php echo $paymentStatus[$order['Order']['payment_status']]; ?>&nbsp;</td>
				<td><?php echo $order['Order']['name']; ?>&nbsp;</td>
				<td class="actions">
					<?php echo $this->Html->link($html->image(HOST.'/actions_16_view.png'), array('action' => 'view', $order['Order']['id']),array('title'=>__("View", true),'escape'=>false)); ?>
					<?php echo $this->Html->link($html->image(HOST.'/actions_16_edit.png'), array('action' => 'edit', $order['Order']['id']),array('title'=>__("Edit", true),'escape'=>false)); ?>					
				</td>
			</tr>
		<?php endforeach; ?>
			</table>
			<p>
			<?php
			echo $this->Paginator->counter(array(
			'format' => __("Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%", true)
			));
			?>	</p>
		
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __("previous", true), array(), null, array('class'=>'disabled'));?>
			 | 	<?php echo $this->Paginator->numbers();?>
		 |
				<?php echo $this->Paginator->next(__("next", true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
		</div>
		
		<div class="clr"></div>	
	</div>		
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>
	<br/>
</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">
	
		<div class="actions">
			<h3><?php __("Actions"); ?></h3>
			<ul>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_add.png'), array('controller' => 'orders', 'action' => 'add'),array('escape'=>false,'title'=>__("New Order", true))); ?><div class="clr"></div>	 <?php echo __("New Order", true)?> </li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_series.png'), array('controller' => 'orders_series', 'action' => 'index'),array('escape'=>false,'title'=>__("List Orders Series", true))); ?> <div class="clr"></div> <?php echo __("List Orders Series", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_customers.png'), array('controller' => 'customers','action' => 'index'),array('escape'=>false,'title'=>__("List Customers",true)));?><div class="clr"></div>	<?php echo __("List Customers",true)?></li>		
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_employees.png'), array('controller' => 'employees', 'action' => 'index'),array('escape'=>false,'title'=>__("List Employees", true))); ?> <div class="clr"></div> <?php echo __("List Employees", true)?></li>
			</ul>
		</div>
		
		<div class="clr"></div>
	</div>		
</div>		
